package com.app.lxx.pregnancyberth.widge;

import android.content.Context;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;

import com.app.lxx.pregnancyberth.R;
import com.squareup.picasso.Picasso;
import com.youth.banner.loader.ImageLoaderInterface;

/**
 * 主页Banner图片加载器
 */
public class BannerLoader implements ImageLoaderInterface {

    @Override
    public void displayImage(Context context, Object path, View imageView) {
        Log.d("d","pic---"+path.toString());
        Picasso.with(context).load((String) path).placeholder(R.drawable.iv_baby_def).error(R.drawable.iv_baby_def).into((ImageView) imageView);
    }

    /**
     * 可以在这做布局
     *
     * @param context
     * @return
     */
    @Override
    public View createImageView(Context context) {
        return new ImageView(context);
    }

//    private TextView getTextView(View view) {
//        TextView textView = view.findViewById(R.id.banner_tv);
//        return textView;
//    }
//
//    private ImageView getImageView(View view) {
//        ImageView imageView = view.findViewById(R.id.banner_iv);
//        return imageView;
//    }
//
//    private View getView(Context context) {
//        View view = View.inflate(context, R.layout.view_banner, null);
//        TextView textView = view.findViewById(R.id.banner_tv);
//        ImageView imageView = view.findViewById(R.id.banner_iv);
//        return view;
//    }
}
